/**
 * @author 邱道长
 * 2019/01/02 上午11:32
 */
package com.qiudaozhang.jblog.backend.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qiudaozhang.jblog.user.service.UserService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping
public class LogoutController {

    private final static Logger LOGGER = Logger.getLogger(LogoutController.class);

    @Reference(url = "${user.service.provider.url}", version = "${service.version}", group = "${dubbo.group}")
    private UserService userService;

    @RequestMapping("logout")
    public String logout(HttpSession session){
        session.removeAttribute("user");
        session.invalidate();
        LOGGER.info("用户退出登录成功");
        return "admin/login";
    }
}
